/*
 * @Author: 严晗 823841034@qq.com
 * @Date: 2023-06-19 16:28:39
 * @LastEditors: 严晗 823841034@qq.com
 * @LastEditTime: 2023-11-09 15:58:28
 * @FilePath: /yike-admin/Users/yanhan/vite-project/vite.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig, normalizePath } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// css原子化框架，有各种css类名提供，集成了开发中所需的css样式
import windi from 'vite-plugin-windicss'

// const variablePath = normalizePath(path.resolve('./src/assets/variable.scss'))

// https://vitejs.dev/config/
export default defineConfig({
	resolve: {
		alias: {
			// 设置src文件夹的别名
			'~': path.resolve(__dirname, 'src'),
		},
	},
	server: {
		proxy: {
			'/api': {
				target: 'http://admin.sit.bxzyhj.vip',
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/api/, ''),
			},
		},
		host: '0.0.0.0'
	},
	plugins: [vue(), windi()],
	// css: {  // css相关配置
	//   preprocessorOptions: {
	//     scss: {
	//       // additionalData 的内容会在每个 scss 文件的开头自动注入
	//       additionalData: `@import "${variablePath}";`
	//     }
	//   }
	// }
})
